function getStyle(obj, attr) {
    if (obj.currentStyle) {
        return obj.currentStyle[attr];
    }
    return window.getComputedStyle(obj, null)[attr];
}

function animate(oEle, attr, target) {
    clearInterval(oEle.timer);
    var step = target > parseInt(getStyle(oEle, attr)) ? 10 : -10;
    oEle.timer = setInterval(function () {
        var current = parseInt(getStyle(oEle, attr))
        oEle.style[attr] = current + step + "px"
        if (Math.abs(target - current) <= Math.abs(step)) {
            oEle.style[attr] = targrt + "px";
            clearInterval(oEle.timer);
        }
    },5)
}